home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / UTILITIE / CPU_MEMO / 3468.ZIP / POPUP.ZIP / GETKEY.ASM < prev    next >
Assembly Source File  |  1988-06-30  |  1KB  |  35 lines

  1. include clink.inc
  2.  
  3. PUBLIC  _getkey;
  4.  
  5. .CODE 
  6.  
  7. ;-----------------------------------------------------------------------------
  8. ; getkey() : Return next key press code. (As an INT)
  9. ;-----------------------------------------------------------------------------
  10. ; getkey() waits for a keypress, and then returns the code for that key.
  11. ; If it is an ordinary key, just the ASCII value is returned.
  12. ; If it is a special key (function key etc), the auxiliary byte is returned
  13. ; in the int, with bit 8 of the int set to indicate that it's a special key.
  14. ;-----------------------------------------------------------------------------
  15.  
  16. STARTPROC       _getkey
  17.  
  18.         mov     ah, 0
  19.         int     16h                     ; Get key from BIOS
  20.         cmp     al, 0
  21.         je      Special                 ; Code 0 for special key
  22.         mov     ah, 0                   ; AL contains ASCII value
  23.         RETPROC
  24.  
  25. Special:
  26.  
  27.         mov     al, ah                  ; Special code into AL
  28.         mov     ah, 1                   ; Set "special" flag
  29.         RETPROC
  30.  
  31. _getkey ENDP
  32.  
  33. END
  34.  
  35.